﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Linq;

namespace QSHC.QSchedule.Web.Models
{
    public partial class Appointment
    {
        #region Property IsSelected
        private bool _isSelected;
        public bool IsSelected
        {
            get { return _isSelected; }
            set
            {
                if (_isSelected != value)
                {
                    _isSelected = value;
                    RaisePropertyChanged("IsSelected");
                }
            }
        }
        #endregion

        public LogAppointment LastLog
        {
            get
            {
                return this.Logs.OrderByDescending(p => p.LogDateTime)
                                .FirstOrDefault();
            }
        }

        public int Postpone
        {
            get
            {
                return this.Logs.Where(p => p.Action == 5).Count();
            }
        }
    }
}
